#define _CRT_SECURE_NO_WARNINGS 1

  struct ListNode {
 	int val;
 	struct ListNode *next;
 	ListNode(int x) : val(x), next(nullptr) {}
  };
 
class Solution {
public:
    ListNode* FindKthToTail(ListNode* pHead, int k)
    {
        ListNode* cur = pHead;
        while (k--)
        {
            if (cur == nullptr)
            {
                return nullptr;
            }
            cur = cur->next;
        }
        ListNode* prev = pHead;
        while (cur)
        {
            cur = cur->next;
            prev = prev->next;
        }
        return prev;
    }
};